var test = 1

$(function () {
  $('#menubtn').click(function(){
    $("#navBar").css({
      backgroundColor:"white",
    })
  })
})

  // 手机号验证
  $('#s_phone').blur(function () {
    var phone = /^1(3\d|4[5-8]|5[0-35-9]|6[567]|7[01345-8]|8\d|9[025-9])\d{8}$/
    if ($(this).val() == '') {
      $('#phoneId').removeClass('ok_prompt')
      $('#phoneId').addClass('error_prompt').html('手机号不能为空!')
    } else if (phone.test($(this).val())) {
      $('#phoneId').removeClass('error_prompt')
      $('#phoneId').addClass('ok_prompt').html('手机号正确!')
    } else {
      $('#phoneId').removeClass('ok_prompt')
      $('#phoneId').addClass('error_prompt').html('请输入合法手机号!')
    }
  })

function mHttp() {
  var s_time = $('#s_time').val()
  var s_name = $('#s_name').val()
  var s_mobile = $('#s_phone').val()
  var s_gender =  $('input:radio[name="sex"]:checked').val();
  var s_job = $('#s_job').val()
  var score = $('#score').val()
  var dec_detail = $('#dec_detail').val()
  var s_video = $("#s_video")[0].files[0];
  var s_image = $("#s_image")[0].files[0];
  var formData = new FormData()

  formData.append('s_time',s_time)
  formData.append('s_name',s_name)
  formData.append('s_mobile',s_mobile)
  formData.append('s_gender',s_gender)
  formData.append('s_job',s_job)
  formData.append('score',score)
  formData.append('s_image',s_image)
  formData.append('s_video',s_video)
  formData.append('dec_detail',dec_detail)

  $.ajax({
      url:host + '/modal',
      type:"post",
      data:formData,
      cache: false, //上传文件不需要缓存
      processData: false, // 告诉jQuery不要去处理发送的数据
      contentType: false, // 告诉jQuery不要去设置Content-Type请求头
      success:function(data) {
        console.log(data);
      },
      error: function(data) {    
        console.log(data)    
    } 
    })
    
  
}